<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>拉勾教育</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
          crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"
            crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
            crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
            crossorigin="anonymous"></script>
    <script src="../js/common.js"></script>
</head>
<body>

<div align="center" style="margin-top: 200px">
    <form>
        <div class="form-group row">
            <label for="orderId" class="col-sm-6 col-form-label">订单编号</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="orderId" value="">
            </div>
        </div>
        <div class="form-group row">
            <label for="userId" class="col-sm-6 col-form-label">用户ID</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="userId" value="">
            </div>
        </div>
        <div class="form-group row">
            <label for="courseId" class="col-sm-6 col-form-label">课程ID</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="courseId" value="">
            </div>
        </div>
        <div class="form-group row">
            <label for="coursePrice" class="col-sm-6 col-form-label">课程原价</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="coursePrice" value="元">
            </div>
        </div>
        <div class="form-group row">
            <label for="orderPrice" class="col-sm-6 col-form-label">实际付款</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="orderPrice" value="元">
            </div>
        </div>
        <div class="form-group row">
            <label for="status" class="col-sm-6 col-form-label">订单状态</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="status" value="">
            </div>
        </div>
        <div class="form-group row">
            <label for="remark" class="col-sm-6 col-form-label">备注</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="remark" value="">
            </div>
        </div>
        <div class="form-group row">
            <label for="createTime" class="col-sm-6 col-form-label">创建时间</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="createTime" value="">
            </div>
        </div>
        <div class="form-group row">
            <label for="expiresTime" class="col-sm-6 col-form-label">失效时间</label>
            <div class="col-sm-6">
                <input type="text" readonly class="form-control-plaintext" id="expiresTime" value="">
            </div>
        </div>
    </form>
</div>
<script>

    $(document).ready(function () {
        var orderId = getUrlParameter("orderId");
        $.get("http://localhost:8080/order/" + orderId, {userId: 1}, function (orderInfo) {
            if (orderInfo != null && orderInfo != "") {
                $("#orderId").val(orderInfo.orderId);
                $("#userId").val(orderInfo.userId);
                $("#courseId").val(orderInfo.courseId);
                $("#coursePrice").val((orderInfo.coursePrice / 100) + "元");
                $("#orderPrice").val((orderInfo.orderPrice / 100) + "元");

                if (orderInfo.status == 1) {
                    $("#status").val("未支付");

                } else if (orderInfo.status == 2) {
                    $("#status").val("完成支付");

                } else if (orderInfo.status == 3) {
                    $("#status").val("已失效");
                }

                $("#remark").val(orderInfo.remark);
                $("#createTime").val(orderInfo.createTime);
                $("#expiresTime").val(orderInfo.expiresTime);
            }
        });
    })

</script>
</body>
</html>